<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>ZipArchive 类</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="zip.examples.html">范例</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ziparchive.addemptydir.html">ZipArchive::addEmptyDir</a></div>
 <div class="up"><a href="book.zip.html">Zip</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="class.ziparchive" class="reference">
 <h1 class="title"> <a href="class.ziparchive.html" class="classname">ZipArchive</a> 类</h1>
 
 
 <div class="partintro"><p class="verinfo">(PHP 5 &gt;= 5.2.0, PECL zip &gt;= 1.1.0)</p>
  
  
  <div class="section" id="ziparchive.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    一个用 Zip 压缩的文件存档。
   </p>
  </div>
  
  
  <div class="section" id="ziparchive.synopsis">
   <h2 class="title">类摘要</h2>
   
   
   <div class="classsynopsis">
    <div class="ooclass"></div>
    
    
    <div class="classsynopsisinfo">
     <span class="ooclass">
      <strong class="classname">ZipArchive</strong>
     </span>
     {</div>
    
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 属性 */</div>
    
    
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="ziparchive.addemptydir.html" class="methodname">addEmptyDir</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$dirname</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="ziparchive.addfile.html" class="methodname">addFile</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$localname</code><span class="initializer"> = <strong><code>NULL</code></strong></span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$start</code><span class="initializer"> = 0</span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$length</code><span class="initializer"> = 0</span></span>
  ]]] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="ziparchive.addfromstring.html" class="methodname">addFromString</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$localname</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$contents</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="ziparchive.addglob.html" class="methodname">addGlob</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$pattern</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code><span class="initializer"> = 0</span></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$options</code><span class="initializer"> = array()</span></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="ziparchive.addpattern.html" class="methodname">addPattern</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$pattern</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$path</code><span class="initializer"> = &#039;.&#039;</span></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$options</code><span class="initializer"> = array()</span></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="ziparchive.close.html" class="methodname">close</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="ziparchive.deleteindex.html" class="methodname">deleteIndex</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$index</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="ziparchive.deletename.html" class="methodname">deleteName</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="ziparchive.extractto.html" class="methodname">extractTo</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$destination</code></span>
   [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$entries</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">string</span><span class="methodname"><a href="ziparchive.getarchivecomment.html" class="methodname">getArchiveComment</a></span>
    ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">string</span><span class="methodname"><a href="ziparchive.getcommentindex.html" class="methodname">getCommentIndex</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$index</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">string</span><span class="methodname"><a href="ziparchive.getcommentname.html" class="methodname">getCommentName</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">string</span><span class="methodname"><a href="ziparchive.getfromindex.html" class="methodname">getFromIndex</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$index</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$length</code><span class="initializer"> = 0</span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">string</span><span class="methodname"><a href="ziparchive.getfromname.html" class="methodname">getFromName</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$length</code><span class="initializer"> = 0</span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">string</span><span class="methodname"><a href="ziparchive.getnameindex.html" class="methodname">getNameIndex</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$index</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">string</span><span class="methodname"><a href="ziparchive.getstatusstring.html" class="methodname">getStatusString</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="type">resource</span><span class="methodname"><a href="ziparchive.getstream.html" class="methodname">getStream</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="type">int</span><span class="methodname"><a href="ziparchive.locatename.html" class="methodname">locateName</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">mixed</span><span class="methodname"><a href="ziparchive.open.html" class="methodname">open</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="ziparchive.renameindex.html" class="methodname">renameIndex</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$index</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$newname</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="ziparchive.renamename.html" class="methodname">renameName</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$newname</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="ziparchive.setarchivecomment.html" class="methodname">setArchiveComment</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$comment</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="ziparchive.setcommentindex.html" class="methodname">setCommentIndex</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$index</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$comment</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="ziparchive.setcommentname.html" class="methodname">setCommentName</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$comment</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="type">array</span><span class="methodname"><a href="ziparchive.statindex.html" class="methodname">statIndex</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$index</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">array</span><span class="methodname"><a href="ziparchive.statname.html" class="methodname">statName</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="ziparchive.unchangeall.html" class="methodname">unchangeAll</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="ziparchive.unchangearchive.html" class="methodname">unchangeArchive</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="ziparchive.unchangeindex.html" class="methodname">unchangeIndex</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$index</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="ziparchive.unchangename.html" class="methodname">unchangeName</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
   )</div>

    
   }</div>
   
   
  </div>
  
  
  <div class="section" id="ziparchive.props">
   <h2 class="title">属性</h2>
   <dl>

    
     <dt id="ziparchive.props.status"><var class="varname"><var class="varname">status</var></var></dt>

     <dd>

      <p class="para"> Zip Archive 的状态</p>
     </dd>

    
    
     <dt id="ziparchive.props.statussys"><var class="varname"><var class="varname">statusSys</var></var></dt>

     <dd>

      <p class="para">Zip Archive 的系统状态</p>
     </dd>

    
    
     <dt id="ziparchive.props.numfiles"><var class="varname"><var class="varname">numFiles</var></var></dt>

     <dd>

      <p class="para">压缩包里的文件数</p>
     </dd>

    
    
     <dt id="ziparchive.props.filename"><var class="varname"><var class="varname">filename</var></var></dt>

     <dd>

      <p class="para">在文件系统里的文件名</p>
     </dd>

    
    
     <dt id="ziparchive.props.comment"><var class="varname"><var class="varname">comment</var></var></dt>

     <dd>

      <p class="para">压缩包的注释</p>
     </dd>

    
   </dl>

  </div>
  
 </div>
 
 
 























































































































































































 
<h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="ziparchive.addemptydir.html">ZipArchive::addEmptyDir</a> — Add a new directory</li><li><a href="ziparchive.addfile.html">ZipArchive::addFile</a> — Adds a file to a ZIP archive from the given path</li><li><a href="ziparchive.addfromstring.html">ZipArchive::addFromString</a> — Add a file to a ZIP archive using its contents</li><li><a href="ziparchive.addglob.html">ZipArchive::addGlob</a> — Add files from a directory by glob pattern</li><li><a href="ziparchive.addpattern.html">ZipArchive::addPattern</a> — Add files from a directory by PCRE pattern</li><li><a href="ziparchive.close.html">ZipArchive::close</a> — Close the active archive (opened or newly created)</li><li><a href="ziparchive.deleteindex.html">ZipArchive::deleteIndex</a> — delete an entry in the archive using its index</li><li><a href="ziparchive.deletename.html">ZipArchive::deleteName</a> — delete an entry in the archive using its name</li><li><a href="ziparchive.extractto.html">ZipArchive::extractTo</a> — Extract the archive contents</li><li><a href="ziparchive.getarchivecomment.html">ZipArchive::getArchiveComment</a> — Returns the Zip archive comment</li><li><a href="ziparchive.getcommentindex.html">ZipArchive::getCommentIndex</a> — Returns the comment of an entry using the entry index</li><li><a href="ziparchive.getcommentname.html">ZipArchive::getCommentName</a> — Returns the comment of an entry using the entry name</li><li><a href="ziparchive.getfromindex.html">ZipArchive::getFromIndex</a> — Returns the entry contents using its index</li><li><a href="ziparchive.getfromname.html">ZipArchive::getFromName</a> — Returns the entry contents using its name</li><li><a href="ziparchive.getnameindex.html">ZipArchive::getNameIndex</a> — Returns the name of an entry using its index</li><li><a href="ziparchive.getstatusstring.html">ZipArchive::getStatusString</a> — Returns the status error message, system and/or zip messages</li><li><a href="ziparchive.getstream.html">ZipArchive::getStream</a> — Get a file handler to the entry defined by its name (read only).</li><li><a href="ziparchive.locatename.html">ZipArchive::locateName</a> — Returns the index of the entry in the archive</li><li><a href="ziparchive.open.html">ZipArchive::open</a> — Open a ZIP file archive</li><li><a href="ziparchive.renameindex.html">ZipArchive::renameIndex</a> — Renames an entry defined by its index</li><li><a href="ziparchive.renamename.html">ZipArchive::renameName</a> — Renames an entry defined by its name</li><li><a href="ziparchive.setarchivecomment.html">ZipArchive::setArchiveComment</a> — Set the comment of a ZIP archive</li><li><a href="ziparchive.setcommentindex.html">ZipArchive::setCommentIndex</a> — Set the comment of an entry defined by its index</li><li><a href="ziparchive.setcommentname.html">ZipArchive::setCommentName</a> — Set the comment of an entry defined by its name</li><li><a href="ziparchive.statindex.html">ZipArchive::statIndex</a> — Get the details of an entry defined by its index.</li><li><a href="ziparchive.statname.html">ZipArchive::statName</a> — Get the details of an entry defined by its name.</li><li><a href="ziparchive.unchangeall.html">ZipArchive::unchangeAll</a> — Undo all changes done in the archive</li><li><a href="ziparchive.unchangearchive.html">ZipArchive::unchangeArchive</a> — Revert all global changes done in the archive.</li><li><a href="ziparchive.unchangeindex.html">ZipArchive::unchangeIndex</a> — Revert all changes done to an entry at the given index</li><li><a href="ziparchive.unchangename.html">ZipArchive::unchangeName</a> — Revert all changes done to an entry with the given name.</li></ul>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="zip.examples.html">范例</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ziparchive.addemptydir.html">ZipArchive::addEmptyDir</a></div>
 <div class="up"><a href="book.zip.html">Zip</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
